package org.hertsig.magiccardmarket.entities;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.AllArgsConstructor;
import lombok.Delegate;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

import org.hertsig.magiccardmarket.entities.Articles.Article;
import org.hertsig.magiccardmarket.entities.Orders.Order;
import org.hertsig.magiccardmarket.entities.Orders.ShippingMethod;

@Getter @ToString
@AllArgsConstructor @NoArgsConstructor
@XmlRootElement(name="response")
public class ShoppingCart implements Iterable<ShoppingCart.Cart> {
	@Delegate(types=Iterable.class) @XmlElement private List<Cart> shoppingCart;
	
	/**
	 * Represents all articles from a single seller in the shopping cart. Reuses entities from {@link Order}
	 */
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class Cart {
		@XmlElement private Actor seller;
		@XmlElement private ShippingMethod shippingMethod;
		@XmlElement private List<Article> article;
		@XmlElement private Double articleValue;
		@XmlElement private Double totalValue;
	}
}
